<div style="height: 7px;"></div>
<div class="content flex-1 bac-aliceblue home-content">
    <!--内容-->
    <div class="content-div">
        <div class="content-div2">
            <div class="flex h-center v-center div1">
                <div class="flex-2">
                    <span>序号</span>
                </div>
                <div class="flex-2">
                    <span >表演者</span>
                </div>
                <div class="flex-3">
                    <span>表演曲目</span>
                </div>
                <div class="flex-2">
                    <span>表演乐器</span>
                </div>
                <div class="flex-2">
                    <span>状态</span>
                </div>
                <div class="flex-3">
                    <span>操作</span>
                </div>
            </div>






        </div>
        <div class="div2">
            {volist name="list" id="vo"}
            <div class="flex h-center v-center div3">
                <div class="flex-2">
                    <span>{$vo['id']}</span>
                </div>
                <div class="flex-2">
                    <span >{$vo['performer']}</span>
                </div>
                <div class="flex-3">
                    <span>{$vo['proname']}</span>
                </div>
                <div class="flex-2">
                    <span>{$vo['musical']}</span>
                </div>
                <div class="flex-2">
                    {if $vo['status'] == 1}
                    <span>准备表演</span>
                    {else}
                    <span>正在表演</span>
                    {/if}
                </div>
                <div class="flex-3 flex">
                    <div class="flex-1 ">
                        {if $vo['status'] == 1}
                        <a href="javascript:;" class="color-blue start" val="{$vo['id']}">
                            <span>开始</span>
                        </a>
                        {else}
                        <a href="javascript:;" class="color-blue start" val="{$vo['id']}">
                            <span></span>
                        </a>
                        {/if}
                    </div>
                    <div class="flex-1 color-crimson">

                        <a href="javascript:;" class="color-crimson mod" val="{$vo['id']}">
                            <span>更改</span>
                        </a>
                    </div>
                    <div class="flex-1 color-red">

                        <a href="javascript:;" class="color-crimson del" val="{$vo['id']}">
                            <span>删除</span>
                        </a>
                    </div>
                </div>
            </div>
            {/volist}
        </div>
        <div class="div4">
            <div class="div5" id="add">
                <a href="#">添加场次</a>
            </div>
        </div>
    </div>
</div>
</div>
</div>


<div class="edit-dialog dialog fill-all flex v-center h-center">

    <div class="corner-white">
        <div class="dialogs-title">
            确认删除？
        </div>
        <div class="flex-1">
            <div>
                <div>表演者</div>
                <div>
                    <input class="inputs" type="text" id="per" placeholder="请输入表演者" />
                </div>
            </div>

            <div>
                <div>表演曲目</div>
                <div>
                    <input class="inputs" type="text" id="game" placeholder="请输入表演曲目" />
                </div>
            </div>

            <div>
            <div>
                <div>表演乐器</div>
                <div>
                    <input class="inputs" type="text" id="tool" placeholder="请输入表演乐器" />
                </div>
            </div>
        </div>

        <div class="btn-container flex">
            <div class="flex-1 flex h-center v-center">
                <a href="javascript:;" class="confirms-cancle btn-class btn-gray flex h-center v-center">
                    取消
                </a>
            </div>
            <div class="flex-1 flex h-center v-center">
                <a href="javascript:;" class="alert-confirm btn-class btn-blue flex h-center v-center">
                    确定
                </a>
            </div>

        </div>

    </div>

</div>
</div>

<div class="edit-dialog1 dialog fill-all flex v-center h-center">

    <div class="corner-white">
        <div class="dialogs-title">
            确认删除？
        </div>
        <div class="flex-1">
            <div>
                <div>表演者</div>
                <div>
                    <input class="inputs" type="text" id="per1" placeholder="请输入表演者" />
                </div>
            </div>

            <div>
                <div>表演曲目</div>
                <div>
                    <input class="inputs" type="text" id="game1" placeholder="请输入表演曲目" />
                </div>
            </div>

            <div>
                <div>
                    <div>表演乐器</div>
                    <div>
                        <input class="inputs" type="text" id="tool1" placeholder="请输入表演乐器" />
                    </div>
                </div>
            </div>

            <div class="btn-container flex">
                <div class="flex-1 flex h-center v-center">
                    <a href="javascript:;" class="confirms-cancle btn-class btn-gray flex h-center v-center">
                        取消
                    </a>
                </div>
                <div class="flex-1 flex h-center v-center">
                    <a href="javascript:;" class="alert-confirm btn-class btn-blue flex h-center v-center">
                        确定
                    </a>
                </div>

            </div>

        </div>

    </div>
</div>


<div class="alert-or-confirm-dialog confirm-dialog dialog fill-all flex v-center h-center">

    <div class="corner-white flex v-flex">
        <div class="dialogs-title">
            确认删除？
        </div>
        <div class="contents flex-1 flex v-center h-center">
            内容<br>
            内容
        </div>

        <div class="btn-container flex">
            <div class="flex-1 flex h-center v-center">
                <a href="javascript:;" class="confirms-cancle btn-class btn-gray flex h-center v-center">
                    取消
                </a>
            </div>
            <div class="flex-1 flex h-center v-center">
                <a href="javascript:;" class="alert-confirm btn-class btn-blue flex h-center v-center">
                    确定
                </a>
            </div>

        </div>

    </div>

</div>


<script>
    $(function(){
        //开始比赛
        $(".start").click(function () {
            var nowId = $(this).attr('val');
            dialog.confirm({color:"red",content:"确定开始？"},function () {
                $.ajax({
                    url:"__SITE__/admin/Program/start",
                    data:{nowId:nowId},
                    type:'POST',
                    dataType:'json',
                    success:function (data) {
                        if(data.status) {
                            alert(data.msg);
                            window.location.reload();
                        }
                    }
                });
            });
        });

        //删除
        $(".del").click(function () {
            var nowId = $(this).attr('val');
            if(confirm('确定删除？')) {
                $.ajax({
                    url:"__SITE__/admin/Program/delPro",
                    data:{nowId:nowId},
                    type:'POST',
                    dataType:'json',
                    success:function (data) {
                        if(data.status) {
                            alert(data.msg);
                            window.location.reload();
                        }
                    }
                });
            }
        });

        //修改
        $(".mod").click(function () {
            var nowId = $(this).attr('val');
            $.ajax({
                url:"__SITE__/admin/Program/selPro",
                data:{nowId:nowId},
                type:'POST',
                dataType:'json',
                success:function (data) {
                    if(data.status == 1) {
                        $("#per1").val(data.data.performer);
                        $("#game1").val(data.data.proname);
                        $("#tool1").val(data.data.musical);
                    }
                }
            });
            editdialog.show(".edit-dialog1","",function () {
                var per = $("#per1").val();
                var game = $("#game1").val();
                var tool = $("#tool1").val();
                $.ajax({
                    url:"__SITE__/admin/Program/modPro",
                    data:{
                        per1:per,
                        game1:game,
                        tool1:tool,
                        nowId:nowId
                    },
                    type:'POST',
                    dataType:'json',
                    success:function (data) {
                        if(data.status) {
                            alert(data.msg);
                            window.location.reload();
                        }
                    }
                });
            });
        });

        //添加
        $("#add").click(function () {
            editdialog.show(".edit-dialog","",function () {
                var per = $("#per").val();
                var game = $("#game").val();
                var tool = $("#tool").val();
                if(checkper() && checkgame() && checktool()) {
                    $.ajax({
                        url:"__SITE__/admin/Program/addPro",
                        data:{per:per,game:game,tool:tool},
                        type:'POST',
                        dataType:'json',
                        success:function (data) {
                            if(data.status == 1) {
                                alert(data.msg);
                                window.location.reload();
                            }
                        }
                    });
                }
            });
        });

        function checkper()
        {
            var per = $("#per").val();
            if(!per) {
                return false;
            }else {
                return true;
            }
        }

        function checkgame()
        {
            var game = $("#game").val();
            if(!game) {
                return false;
            }else {
                return true;
            }
        }

        function checktool()
        {
            var tool = $("#tool").val();
            if(!tool) {
                return false;
            }else {
                return true;
            }
        }


















        //切换选中示例
        //home,lists,history,account,running,
        var select_tab = "lists";
        if(!select_tab){
            select_tab = "home";
        }
        $(".menu .menu-div").removeClass("bac-blue");

        $(".menu #tab_"+select_tab).addClass("bac-blue");
        if(select_tab=="home"){
            $(".running-right").hide();
        }
        if(select_tab=="running"){
            $("#tab_running").addClass("bac-blue");
        }
    });
</script>
</body>
</html>